<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    function fn(...args) {
      console.log('this==', this)
      console.log('args==', args)
    }
    let obj = {
      name: 'zhen',
    }
    let newFn = fn.bind(obj, 1, 2, 3)
    // newFn(4, 5)
    // fn(1, 2)
    // log('hahahahha')
    // console.log('ttt', tt)
    var tt = 123
    log = function (msg) {
      console.log.bind(console, msg)()
    }
    // console.log('log222===', log)

    Function.prototype.bind2 = function (context) {
      let _this = this
      let args = Array.prototype.slice.call(arguments, 1)
      return function () {
        return _this.apply(context, args)
      }
    }
    let log2 = (msg) => console.log.bind2(console, msg)()
    log2('哈哈哈哈')
  </script>
</html>
